package dao

import models.Tables._
import play.api.db.slick.{DatabaseConfigProvider, HasDatabaseConfigProvider}
import slick.jdbc.JdbcProfile

import javax.inject.Inject
import scala.concurrent.{ExecutionContext, Future}

class PhenotypeDao @Inject()(protected val dbConfigProvider: DatabaseConfigProvider)
                            (implicit exec: ExecutionContext) extends
  HasDatabaseConfigProvider[JdbcProfile] {

  import profile.api._

  def getAll: Future[Seq[PhenotypeRow]] = {
    db.run(Phenotype.result)
  }

  def getById(id: Int): Future[PhenotypeRow] = {
    db.run(Phenotype.filter(_.id === id).result.head)
  }

}
